package com.colbby.datahouse.transform;

import com.colbby.datahouse.utils.CastUtils;
import com.colbby.datahouse.utils.TypeDescriptor;
import com.colbby.datahouse.utils.TypeUtils;

public class ByteTransformer implements DataTypeTransform<Byte> {

	public static final ByteTransformer INSTANCE = new ByteTransformer();
	
	@Override
	public Byte transform(TypeDescriptor returnType, Object value) {
		return CastUtils.castToByte(CastUtils.getValue(value));
	}

	@Override
	public boolean shouldDo(TypeDescriptor returnType, Object value) {
		return TypeUtils.isSuperClass(Byte.class, returnType.getTypeClass());
	}
}
